#include <stdint.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
#include <poll.h>


void* ioctl01(void *ptr) {
	int fd = open("/dev/t01", O_RDWR, O_NONBLOCK);
	while(1){
		//led on
		ioctl(fd, 0, 100);
		sleep(2);
		//led off
		ioctl(fd, 1, 100);
		sleep(2);
	}
	close(fd);
	return NULL;
}

int main() {
	pthread_t thread;
	pthread_create(&thread, NULL, ioctl01, NULL);
	sleep(2);
	pthread_join(thread, NULL);
	printf("main exit\n");
	return EXIT_SUCCESS;
}

